<!DOCTYPE html>
<html>
    <head>
        <meta charest="UTF-8">
        <title>函数求阶乘</title>
    </head>
    <body>
        <script>
            function getJC(n){
                if(n == 1){
                    return 1;
                }
                return n*factorial(n-1);
            }
            var n= prompt('请输入n的值:');
            n=parseInt(n);
            if(isNaN(n)){
                console.log('输入的n值不合适');
            }else{
                console.log(n+'的阶乘为'+factorial(n));
            }
            function getSum(n){
                var sum=0;
                for(i=0;i<100;i++){
                    sum+=i;
                }
                console.log(sum);
            }
        </script>
    </body>
</html>